package com.rr.sc.model.util;

import com.rr.sc.model.Account;
import com.rr.sc.model.Category;
import com.rr.sc.model.Transaction;
import com.rr.sc.security.SecurityUtils;

public class ModelFactory {

	public static Category newCategory() {
		Category category = new Category();
		category.setParentCategory(new Category());
		category.setUser(SecurityUtils.getLoggedUser());
		return category;
	}

	public static Transaction newTransaction() {
		Transaction transaction = new Transaction();
		transaction.setAccount(newAccount());
		transaction.setCategory(newCategory());
		transaction.setParentTransaction(new Transaction());
		transaction.setUser(SecurityUtils.getLoggedUser());
		return transaction;
	}

	public static Account newAccount() {
		Account account = new Account();
		account.setUser(SecurityUtils.getLoggedUser());
		return account;
	}
}
